<%--
  Created by IntelliJ IDEA.
  User: xiaoji
  Date: 2014/11/24
  Time: 14:13
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set value="${pageContext.request.contextPath}" var="path" scope="session"/>
<!DOCTYPE html>

<html>
<head>
    <title>提现审核</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="${path}/plugins/jquery-easyui-1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${path}/plugins/jquery-easyui-1.4.1/themes/icon.css">
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/jquery.min.js"></script>
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="${path}/plugins/jquery-easyui-1.4.1/locale/easyui-lang-zh_CN.js"></script>
    <script language="javascript" type="text/javascript" src="${path}/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        $(function(){
            //查询
            $("#search_tx").click(function(){


                var currenttab =  $("#search_tx").attr("stab");
                $('#'+currenttab).datagrid('load',{
                    withdraw_id:$("#withdrawId").val(),
                    userName:$("#userName").val(),
                    withdraw_status:$("#withdrawStatus").combobox("getValue")
                });
            });


        });
        //提现审核---同意
        function f_agree(user_name,money,withdraw_id){
            if(confirm("是否已为" + user_name + " 打款" + money +"？")) {
                $.post("${path}/fundManage/changeWithdrawStatus.do",{
                    withdrawId:withdraw_id,withdrawStatus:130103
                },function(data){
                    if(data.errormsg == undefined){
                        $('#ttAll').datagrid('reload');
                    }else{
                        alert(data.errormsg);
                    }
                },"json");
            }
        }
        //提现审核---打回
        function f_callBack(user_name,withdraw_id){
            if(confirm("是否打回" + user_name + " 申请的提现？")) {
                $.post("${path}/fundManage/changeWithdrawStatus.do",{
                    withdrawId:withdraw_id,withdrawStatus:130102
                },function(data){
                    if(data.errormsg == undefined){
                        $('#ttAll').datagrid('reload');
                    }else{
                        alert(data.errormsg);
                    }
                },"json");
            }
        }



    </script>
</head>
<body class="easyui-layout">
<div region="center" style="padding:5px;" border="false"  style="height: 650px;">
    <%--<div id="tabs" class="easyui-tabs" style="width:100%;height: 650px;">--%>
        <%--<div title="提现审核" style="padding:10px">--%>
            <!--列表-->
            <table id="ttAll" class="easyui-datagrid"
                   data-options="singleSelect:true,collapsible:true,url:'${path}/fundManage/withdraw.do',rownumbers: true,
       method:'get',toolbar:'#txbh',pagination:'true',fit:'true'">
                <thead>
                <tr>
                    <th data-options="field:'withdraw_id',align:'center',width:80">用户提现编号</th>
                    <th data-options="field:'user_name',align:'center',width:80">用户账号</th>
                    <th data-options="field:'money',align:'center',width:80">提现金额</th>
                    <th data-options="field:'apply_time',align:'center',width:180">申请日期</th>
                    <th data-options="field:'alipayAccount',align:'center',width:180">支付宝账号</th>
                    <th data-options="field:'real_name',align:'center',width:180">用户真实姓名</th>
                    <th data-options="field:'withdraw_status',align:'center',width:80,formatter: rowformatter1">状态</th>
                    <th data-options="field:'cz',align:'center',width:180,formatter: rowformatter">操作</th>
                </tr>
                </thead>
            </table>
        <%--</div>--%>

    <%--</div>--%>
</div>
<!--提现审核 头工具项-->
<div id="txbh" style="padding:2px 5px;">
    提现编号: <input class="easyui-textbox" name="withdrawId" id="withdrawId" style="width:110px">
    用户账号: <input class="easyui-textbox" name="userName" id="userName" style="width:110px">
    处理状态:
            <select class="easyui-combobox" data-options="editable:false" name="withdrawStatus" id="withdrawStatus" style="width:110px">
                <option value="">所有</option>
                <option value="130101">待处理</option>
                <option value="130102">已打回</option>
                <option value="130103">打款成功</option>
            </select>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" id="search_tx" stab="ttAll">查找</a>
</div>
<script>

    //提现审核---操作
    function rowformatter(value,row,index){


        if(row.withdraw_status == 130101){
            return  "<a href='javascript:void(0)' onclick=\"f_agree(\'"+row.user_name+"\',"+row.money+","+row.withdraw_id+")\">已完成打款</a> " +
                    "<a href='javascript:void(0)' onclick=\"f_callBack(\'"+row.user_name+"\',"+row.withdraw_id+")\">打回</a> " ;
        }

        return  "";
    }
    ////提现审核---格式化状态
    function rowformatter1(value,row,index){

        if(value == 130101){
            return  "待处理";
        }else if(value == 130102){
            return  "已打回";
        }else if(value == 130103) {
            return  "打款成功";
        }

        return  value;
    }
    function rowformatter4(value,row,index){
        var str = "";
        return  '<a href="#" onclick="examine('+row.id+',\''+row.title+'\','+index+')">审核通过</a>&nbsp;&nbsp;';
    }
</script>
</body>
</html>
